<template>
  <el-date-picker
    v-bind="$attrs"
    v-on="$listeners"
    v-model="_date"
    @change="$emit('change',$event)"
    :type="type"
    :placeholder="$t('common.xuanzeriqi')"
    :value-format="valueFormat"
  >
  </el-date-picker>
</template>

<script>
export default {
  model: {
    prop: "date",
    event: "change",
  },
  props: {
    date: {
      type: String,
      default: "",
    },
    type: {
      type: String,
      default: "datetime",
    },
    valueFormat:{
      type:String,
      default:"yyyy-MM-dd HH:mm:ss"
    }
  },
  computed: {
    _date: {
      get() {
        return this.date;
      },
      set(val) {
        this.$emit("change", val);
      },
    },
  },
};
</script>

<style lang="less" scoped>
.el-input__prefix {
  right: 10px; /* 调整图标位置 */
  left: auto !important;
}
.el-date-editor.el-input,
.el-date-editor.el-input__inner {
  width: 200px !important;
}
</style>
